import { withErrors, ok, apiError } from "@/lib/api"; import { requireUser } from "@/lib/auth"; import { getSource } from "@/lib/store"; import { ensureFresh } from "@/lib/refresh"; // POST /api/sources/:id/refresh — force a fresh fetch now. export const POST = withErrors(async (req, { params }) => { await requireUser(req); const { id } = await params; const source = getSource(id); if (!source) return apiError("not_found", "Source not found", 404); const state = await ensureFresh(source, { force: true }); return ok({ source: state }); });